//
//  LaunchViewController.h
//  Youhu
//
//  Created by Jason
//  Copyright © 2016年 ApeStar. All rights reserved.
//
#import "LaunchViewController.h"
//#import "MIntroduceView.h"
//#import "AppRequest+Other.h"
//#import "VersionModel.h"

@interface LaunchViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *launchImageView;

@end

@implementation LaunchViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.launchImageView.image = [UIImage tx_appLaunchImage];
    
//    [self requestUpdateApp];
}

-(void) viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    //    kWeakSelf;
    //假装登录请求
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//        if([AuthorManager isLogin]) {
            //已登录，设置app类型
//            AppTarget target = [kUserDefaults integerForKey:UD_APP_TARGET_KEY];
//            [AppRequest shared].requestAppTarget = target;
            [kGlobalVC setRootByHome:NO];
//        }else{
//            [kGlobalVC setRootByLogin:NO];
//        }
//        [self showGuideView];
    });
}


#pragma mark - LaunchPresenterDelegate


#pragma mark - 首次登录引导图
//-(void)showGuideView{
//    //向导
//    if ([MIntroduceView isIntroduceNeedDisplayAtLaunch]) {
//        MIntroduceView *introduceView = [[MIntroduceView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
//        AppDelegate* myDelegate = (((AppDelegate*) [UIApplication sharedApplication].delegate));
//        
//        [myDelegate.window addSubview:introduceView];
//    }
//}

#pragma mark - Request
//- (void)requestUpdateInfo {
//    
//    [CheckUpdateMgr checkNewVersion:^(BOOL hasNewVersion, NSString *downloadURL) {
//        if (hasNewVersion) {
//            NSString *forceUpdateInfo = @"赶快去更新吧，更多精彩内容等着你";
//            [UIAlertView alertViewWithTitle:forceUpdateInfo message:nil cancelButtonTitle:@"更新" otherButtonTitles:nil onDismiss:^(int buttonIndex) {
//                
//            } onCancel:^{
//                
//                [[UIApplication sharedApplication] openURL:[NSURL
//                                                            URLWithString:downloadURL]];
//            }];
//        }
//    } errorBlock:^(FailureResponseModel *errorRes) {
//        
//    }];
//}

//- (void)requestUpdateApp{
//    [AppRequest appUpdateOnSuccessBlock:^(VersionModel * response) {
//        if (response.update_flag == 1) {
//            [UIAlertView tx_alertWithCallBackBlock:^(NSInteger buttonIndex) {
//                [[UIApplication sharedApplication] openURL:[NSURL URLWithString:response.version_url]];
//            } title:response.version_name message:response.version_remark cancelButtonName:@"升级版本" otherButtonTitles:nil, nil];
//        }else if (response.update_flag == 2) {
//                [UIAlertView tx_alertWithCallBackBlock:^(NSInteger buttonIndex) {
//                    if (buttonIndex == 1) {
//                        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:response.version_url]];
//                    }
//                } title:response.version_name message:response.version_remark cancelButtonName:@"取消" otherButtonTitles:@"升级版本", nil];
//        }
//    } errorBlock:^(FailureResponseModel *failureResponse) {
//        
//    }];
//}
#pragma mark - end

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
